@layout("/common/_container.html"){
<style>
    ul{padding: 0;margin: 0;}
    .ulBox{display: flex} .ulBox>li{flex: 1;} .ulBox>li li{margin: 15px 0}
    .ulBox>li span{display: inline-block ; width: 120px;}
    .frameBox{width: 60%;height: 32px;padding-left: 10px;border: 1px solid #cccccc;border-radius: 5px;}
    .btnBox{margin-top: 15px;}
    .btnBox>button{margin: 0;  color: white;  background: #2b6594;  width: 100px;  font-size: 1em;border: 1px solid #cccccc}
</style>

<div class="ibox float-e-margins">
    <div class="ibox-content">
        <div class="form-horizontal" id="updateInfoForm">
            <div style="display: none">
                <input type="hidden" id="oneChannelValue" value="">
                <input type="hidden" id="twoChannelValue" value="">
                <input type="hidden" id="thrChannelValue" value="">
                <input type="hidden" id="outpatientNameValue" value="${outpatientName}">
                <input type="hidden" id="reservationsId" value="${reservationsId}">
            </div>

            <div class="row">
                <div class="col-sm-12">
                    <div>
                        <ul class="ulBox">
                            <li>
                                <span>提交门店</span>
                                <input type="text" id="outpatientName" value="${reservationsInfo.outpatientName}" class="frameBox" value="" readonly="readonly">
                            </li>
                            <li></li>
                        </ul>
                    </div>
                    <div>
                        <ul class="ulBox">
                            <li>
                                <ul>
                                    <li>
                                        <span>原建档人</span>
                                        <input type="text"  id="name" value="${reservationsInfo.archiving}" class="frameBox" value="" readonly="readonly">
                                    </li>
                                    <li>
                                        <span>一级渠道</span>
                                        <input  id="sOneChannel"  value="${reservationsInfo.oneChannel}" class="frameBox" readonly="readonly"></input>
                                    </li>

                                    <li>
                                        <span>二级渠道</span>
                                        <input  id="sTwoChannel"  value="${reservationsInfo.twoChannel}" class="frameBox" readonly="readonly"></input>
                                    </li>
                                    <li>
                                        <span>三级渠道</span>
                                        <input  id="sThrChannel"  value="${reservationsInfo.thrChannel}" class="frameBox" readonly="readonly"></input>
                                    </li>
                                </ul>
                            </li>
                            <li>
                                <ul>
                                    <li>
                                        <span>新建档人</span>
                                        <input type="text" id="user" value="${user}" class="frameBox">
                                    </li>
                                    <li>
                                        <span>一级渠道</span>
                                        <select  id="oneChannel" name="oneChannel" class="frameBox"></select>
                                    </li>
                                    <li>
                                        <span>二级渠道</span>
                                        <select  id="twoChannel" name="twoChannel" class="frameBox"></select>
                                    </li>
                                    <li>
                                        <span>三级渠道</span>
                                        <select  id="thrChannel" name="thrChannel" class="frameBox"></select>
                                    </li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                    <div>
                        <span style="display: inline-block;width: 120px;">备注</span>
                        <input  id="remarks" name="remarks" class="frameBox">
                    </div>
                </div>
                <div class="col-sm-12">
                    <div class="btnBox">
                        <button type="button" class="btn" id="ensure">提交</button>
                        <button type="button" class="btn" id="cancel" style="background: #999999" >取消</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="${ctxPath}/static/js/common/jsAddresss.js"></script>
<script src="${ctxPath}/static/js/common/jsChannel.js"></script>
<script src="${ctxPath}/static/js/common/jsMedium.js"></script>
<script type="text/javascript">
    var oneChanneli = document.getElementById("oneChannelValue").value;
    var twoChanneli = document.getElementById("twoChannelValue").value;
    var thrChanneli = document.getElementById("thrChannelValue").value;
    var ChannelList;
    //初始化下拉渠道列表
    $.post(Feng.ctxPath + "/channel/getChannelsss", function (data) {
        ChannelList = data;
        channelInit('oneChannel', 'twoChannel', 'thrChannel');
    }, "json");

    /**
     * 渠道修改提交
     */
    $("#ensure").click(function () {
        var name = $("#name").val();                   //建档人
        var user = $("#user").val();                   //建档人
        var sOneChannel = $("#sOneChannel").val();     //原一级渠道
        var sTwoChannel = $("#sTwoChannel").val();     //原二级渠道
        var sThrChannel = $("#sThrChannel").val();     //原三级渠道
        var oneChannel = $("#oneChannel").val();       //一级渠道
        var twoChannel = $("#twoChannel").val();       //二级渠道
        var thrChannel = $("#thrChannel").val();       //三级渠道
        var remarks = $("#remarks").val();             //备注
        var outpatientName = $("#outpatientNameValue").val();             //门诊
        var reservationsId = $("#reservationsId").val();
        if(remarks == "" || remarks == null){
            alert("请输入备注！");
            return;
        }
        $.ajax({
            url: Feng.ctxPath + "/customer/update_channel",
            type: "post",
            data: {
                name:name,sOneChannel:sOneChannel,sTwoChannel:sTwoChannel,sThrChannel:sThrChannel,reservationsId:reservationsId,
                oneChannel:oneChannel,twoChannel:twoChannel,thrChannel:thrChannel,remarks:remarks,outpatientName:outpatientName,user:user
            },
            success: function (data) {
                Feng.success('操作成功!');
                $("#cancel").click()
            },
            error: function (data) {
                alert('内部故障!');
            }
        });
    });

    $("#cancel").click(function () {
        var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        parent.layer.close(index);
    })

</script>
@}
